package cn.shyouchi.wuguanjia.android.ui.patrol.statistic;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;
import cn.shyouchi.wuguanjia.android.impl.ModuleItemClickListener;

/**
 * Created by Eenie on 2016/12/28 at 9:50
 * Email: 472279981@qq.com
 * Des:
 */

public class PreviewPatrolRingDesAdapter extends BaseQuickAdapter<PatrolStatisticEntity.ResultMessageBean.InfoBean, BaseViewHolder> {

    ModuleItemClickListener mItemClickListener;

    public PreviewPatrolRingDesAdapter(List<PatrolStatisticEntity.ResultMessageBean.InfoBean> data, ModuleItemClickListener listener) {

        super(R.layout.item_patrol_ring_des_layout, data);
        this.mItemClickListener = listener;
    }

    @Override
    protected void convert(BaseViewHolder holder, final PatrolStatisticEntity.ResultMessageBean.InfoBean entity) {
        holder.setText(R.id.model_name, String.format("第%1s圈", holder.getAdapterPosition() + 1));
        holder.setText(R.id.tv_holder_name, String.format("共%1s个巡检点位", entity.getInspection().size()));

        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mItemClickListener.moduleItemClick(entity);
            }
        });
    }


}
